﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Web.Http;
using Gecko.Services;
using Gecko.Models;
using Gecko.Models.Dto;

namespace Gecko.Controllers
{
    public class UserInfoController : ApiController
    {
        // GET api/userinfo
        public ServiceResponse<IList<UserInfoDto>> Get()
        {
            using (var userInfoService = new UserInfoService())
            {
                return userInfoService.GetAllUser();
            }
        }

        // GET api/userinfo/5
        public ServiceResponse<UserInfoDto> Get(int id)
        {
            using (var userInfoService = new UserInfoService())
            {
                return userInfoService.GetById(id);
            }
        }

        // POST api/userinfo
        public ServiceResponse<UserInfoDto> Post(UserInfoDto value)
        {
            using (var userInfoService = new UserInfoService())
            {
                return userInfoService.AddUserInfo(value);
            }
        }

        // PUT api/userinfo/5
        public void Put(int id, [FromBody]string value)
        {
        }

        // DELETE api/userinfo/5
        public void Delete(int id)
        {
        }
    }
}
